/**
 *------------------------------------------------------------------------------
 *  @copyright Copyright (c) 2022  <dx_65535@163.com>. 
 * 
 *  @file       : common_type.h
 *  @author     : Xiang.D (dx_65535@163.com)
 *  @version    : 1.0
 *  @brief      : Blog: https://linuxtaoist.gitee.io
 *  @date       : 2022-06-04
 * 
 * 
 *  Change History:
 *  <Date>     | <Version> | <Author>       | <Description>
 *------------------------------------------------------------------------------
 *  2022/06/04 | 1.0.0.1   | Xiang.D        | Create file
 *------------------------------------------------------------------------------
 * 
 */

#ifndef __COMMON_TYPE_H__
#define __COMMON_TYPE_H__

// -------------   Data Protocol   -------------
typedef enum
{
    CHANNEL_UART     = 0x01,
    CHANNEL_MQ,
    CHANNEL_SIG,
    CHANNEL_BUT
} ETransChannel;

typedef enum
{
    CMD_LED             = 0x1 ,
    CMD_MOTOR           = 0x2 ,
    CMD_TYPE_MAX
} ECmdType;

#define CMD_BYTES       16
typedef enum
{
    /***************  LED  ***************/
    CMD_LED_ON          = CMD_LED << CMD_BYTES | 1,
    CMD_LED_OFF,
    CMD_LED_HORSE,

    /*************** MOTOR ***************/
    CMD_MOTOR_FORWARD   = CMD_MOTOR << CMD_BYTES | 1,
    CMD_MOTOR_BACKWARD,

    CMD_ACTION_MAX
} ECmdAction;

typedef void (*MsgHanderPtr)(void *);

#define MAX_SIZE_CONTENT 50
typedef struct
{
    ETransChannel channel;
    ECmdAction    cmdAction;
    int           length;
    char          content[MAX_SIZE_CONTENT];
} SCmdFrame;

typedef struct
{
    SCmdFrame    frame;
    MsgHanderPtr handler;
} SMsgEventPacket;

// ------------- Data Protocol End -------------









#endif
